
package trim.differentmaterials.resttrimmer;

import trim.differentmaterials.core.*;
import trim.differentmaterials.generator.core.*;
import trim.differentmaterials.generator.columns.*;

/**
 *
 * @author Podorov Alexander
 */

public class ExactMaterialsRestTrimmer extends RestTrimmer
{
    public ExactMaterialsRestTrimmer(TrimCore core, Generator generator)
    {
        super(core, generator);
    }   

    protected void restsToPatterns()
    {
        for (int i = 0; i < materialCount; i++)
        {
            if (materialRests[i] > 0)
            {             
                Column pattern = generator.getMinimumRestPatternIn(i);
                ((RealPattern)pattern).setCount(materialRests[i]);
                patterns.add(pattern);
                materialRests[i] = 0;
            }
        }
    }

    public void start()
    {
        setMaterialRests();
        restsToPatterns();
    }
}
